<%--
  Created by IntelliJ IDEA.
  User: 14258
  Date: 2020/9/2
  Time: 2:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>$Title$</title>
  </head>
  <body>
  <h1>index.jsp</h1>
  <a href="/testCookie">发送cookie请求</a>
  <%
    String val = "";
    Cookie[] cookies = request.getCookies();
    if (cookies!=null){
      for (Cookie cookie : cookies){
        if (cookie.getName().equals("u1")){
          val = cookie.getValue();
          break;
        }
      }
      request.setAttribute("val",val);
    }
  %>
  <form method="post" action="/login">
    <input type="text" name="uName" value="${val}"><input type="submit" value="登录">
  </form>
  </body>
</html>
